package com.htgd.gardenexpo.entity;

/**
 * @author ：hejing
 * @date ：Created in 2021/5/24 10:00
 * @description：返回实体类
 * @modified By：`
 * @version: 1.0
 */

public class CommonResult<T> {
    private Integer code;
    private String message;
    private T data;
    private T data1;

    public CommonResult() {

    }

    public CommonResult(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static <T> CommonResult<T> success() {
        CommonResult<T> result = new CommonResult<T>();
        result.code = 200;
        return result;
    }

    public static <T> CommonResult<T> success(String message,T data) {
        CommonResult<T> result = new CommonResult<T>();
        result.data = data;
        result.code = 200;
        result.message = message;
        return result;
    }

    public static <T> CommonResult<T> success(String message) {
        CommonResult<T> result = new CommonResult<T>();
        result.code = 200;
        result.message = message;
        return result;
    }

    public static <T> CommonResult<T> error(String message) {
        CommonResult<T> result = new CommonResult<T>();
        result.code = 300;
        result.message = message;
        return result;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public T getData1() {
        return data1;
    }

    public void setData1(T data1) {
        this.data1 = data1;
    }
}

